﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using STLGROUP.Layers.Presentations;
using STLGROUP.Layers.ReportTemplates;
using STLGROUP.Layers.Common;

namespace QuanLyBanHang
{
    public partial class RF006 : frmReportBase
    {
        private int _iDDonHang;

        public RF006()
        {
            InitializeComponent();
            this.Load += new EventHandler(RF006_Load);
        }

        private void RF006_Load(object sender, EventArgs e)
        {
            try
            {
                CR006_ThongKeDoanhThu rp = new CR006_ThongKeDoanhThu();

                var data = Cache.Context.View_ThongKeDoanhThu.Select(s => new { 
                    s.HoTenNhanVien,
                    s.MaHoaDon,
                    s.MaKhachHang,
                    s.HoTenKhachHang,
                    s.TongTien,
                    s.DaTra,
                    s.ConLai,  
                    s.NgayTao
                });
               
                rp.SetDataSource(data);

                crystalReportViewer.ReportSource = rp;

            }
            catch (Exception ex)
            {
                UICommon.ShowMessgeString("Xảy ra lỗi trong quá trình xuất báo cáo doanh thu "+ex.Message, "Lỗi xuất report");
            }
        }
    }
}
